package com.cy.store.util;

import java.io.Serializable;

/**
 * @auther 尚智江
 * @Date 2022/7/17 0:34
 */
/**
 * JSON 格式的数据进行响应
 * */
public class JSONResult<E> implements Serializable {
    // 状态码
    private Integer state;
    // 描述信息
    private String message;
    // 泛型数据用 E
    private E data;

    public JSONResult() {
    }

    public JSONResult(Integer state) {
        this.state = state;
    }
    public JSONResult(Throwable e){
        this.message = e.getMessage();
    }
    public JSONResult(Integer state,E data){
        this.state = state;
        this.data = data;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }
}
